local quhu = fk.CreateSkill {
  name = "lvshi__quhu",
  tags = {"Phase"},
}

Fk:loadTranslationTable {
  ["lvshi__quhu"] = "驱虎",
  [":lvshi__quhu"] = "阶段技，你可令两名角色拼点，然后你选择:1.令赢的角色对一名其选择的角色造成1点伤害；2.令赢的角色对你造成1点伤害。",
  ["#lvshi__quhu-prompt"] = "选择两名角色拼点",
  ["#quhu-choose"] = "驱虎：请选择一名角色",
  ["lvshi__quhu1"] = "对%src选择的角色造成1点伤害",
  ["lvshi__quhu2"] = "对你造成1点伤害",
  ["quhu_tip_1"] = "发起拼点",
  ["quhu_tip_2"] = "被拼点",

  ["$lvshi__quhu1"] = "厉虎短智，自当为我所用！",
  ["$lvshi__quhu2"] = "损彼以利己，其道上行也。",

}


quhu:addEffect("active", {
  anim_type = "control",
  target_num = 2,
  card_num = 0,
  prompt = "#lvshi__quhu-prompt",
  can_use = function(self, player)
    return player:usedSkillTimes(quhu.name, Player.HistoryPhase) == 0
  end,
  card_filter = Util.FalseFunc,
  target_filter = function(self, player, to_select, selected)
    if #selected == 0 then
      return not to_select:isKongcheng()
    elseif #selected == 1 then
      return selected[1]:canPindian(to_select)
    else
      return false
    end
  end,
  target_tip = function(self, player, to_select, selected, _, _, selectable, _)
    if not selectable then return end
    if #selected == 0 then
      return "quhu_tip_1"
    else
      return "quhu_tip_2"
    end
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target1 = effect.tos[1]
    local target2 = effect.tos[2]
    local pindianData = target1:pindian({ target2 }, quhu.name)
    local winner = pindianData.results[target2].winner
    if winner then
      local choices = {"lvshi__quhu1:"..winner.id, "lvshi__quhu2"}
      local choice = room:askToChoice(player, {choices = choices, skill_name = quhu.name})
      local victim = player
      if choice == choices[1] then
        local to = room:askToChoosePlayers(winner, {
          targets = room.alive_players,
          max_num = 1,
          min_num = 1,
          skill_name = quhu.name,
          cancelable = false,
          prompt = "#quhu-choose",
        })
        victim = to[1]
      end
      room:damage{
        from = winner,
        to = victim,
        damage = 1,
        damageType = fk.NormalDamage,
        skillName = quhu.name,
      }
    end
  end,
})

return quhu